package study.JavaBase;

/**
 * date:2025.10.13
 * title:java分支结构
 * author：fzy
 */

public class Java_7 {
    public static void main(String[] args) {
        ConditionTest.ifElseTest();
        ConditionTest.switchTest();
    }
}


class ConditionTest {
    static void ifElseTest() {
        int a = 0;
        do {
            a++;
            if (a < 10) {
                System.out.println("a当前小于10:" + a);
            } else {
                System.out.println("a当前大于10:" + a);
            }
        } while (a < 20);
    }

    static void switchTest() {
        int[] arr = {1, 2, 5, 12, 45};
        for (int a : arr) {
            switch (a) {
                case 1:
                    System.out.println("a1:" + a);
                    break;
                case 2:
                    System.out.println("a2:" + a);
                    break;
                default:
                    System.out.println("a:" + a);

            }
        }
    }
}
